
package com.elong.common.service;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

import com.elong.common.http.FluentHttpsAPI;
import com.elong.common.http.HttpResult;


public class TrainService {

    public static void main(String[] args) {
        FluentHttpsAPI api = new FluentHttpsAPI();
        HttpResult result = api.URLGetImage("https://kyfw.12306.cn/otn/passcodeNew/getPassCodeNew?module=login&rand=sjrand");
        String username = "gaoguanguo";
        String password = "a3729291988";
        String randCode = "";
        Scanner scan = new Scanner(System.in);
        randCode = scan.next();
        scan.close();
        String loginUrl = "https://kyfw.12306.cn/otn/login/loginAysnSuggest";
        Map<String, String> loginMap = new HashMap<String, String>();
        loginMap.put("loginUserDTO.user_name", username);
        loginMap.put("userDTO.password", password);
        loginMap.put("randCode", randCode);
        HttpResult result2 = api.URLPost(loginUrl, loginMap, true);
        String initUrl = "https://kyfw.12306.cn/otn/index/init";
        HttpResult result3 = api.URLGet(initUrl);
        System.out.println(result3.getRetContent());
    }
}
